package com.xiaobaibai.controller;

import com.xiaobaibai.entity.Category;
import com.xiaobaibai.response.ResponseFormat;
import com.xiaobaibai.service.ICategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@Api(tags = "分类数据接口")
@RequestMapping("/category")
@CrossOrigin
public class CategoryController {

    @Autowired
    private ICategoryService categoryService;

    @GetMapping("/list")
    @ApiOperation("获取所有类别")
    public ResponseFormat getCategoryList(){
        List<Category> categoryList = categoryService.getCategoryList();
        return ResponseFormat.ok("分类数据获取成功",categoryList);
    }

}
